package com.learn.project2.controller.admin;

import com.learn.project2.model.bo.admin.comment.CommentDeleteBO;
import com.learn.project2.model.bo.admin.comment.CommentListBO;
import com.learn.project2.model.vo.admin.comment.CommentListVO;
import com.learn.project2.service.admin.comment.CommentService;
import com.learn.project2.utils.Result;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description:
 * @author 岳子昂
 * @date 2022-01-06 21:37
 * @version 1.0
 */
@RestController
@RequestMapping("admin/comment")
public class CommentController {
    @Autowired
    CommentService commentService;

    /**
     * @description: 40
     * @param:
     * @return:
     * @author 岳子昂
     * @date: 2022-01-06 21:39
     */
    @RequestMapping("list")
    @RequiresPermissions(value = {"admin:comment:list"})
    public Result list(CommentListBO commentListBO){
        CommentListVO commentListVO = commentService.commentList(commentListBO);
        return Result.ok(commentListVO);
    }

    /**
     * @description: 41
     * @param:
     * @return:
     * @author 岳子昂
     * @date: 2022-01-06 21:39
     */
    @RequestMapping("delete")
    @RequiresPermissions(value = {"admin:comment:delete"})
    public Result delete(@RequestBody CommentDeleteBO commentDeleteBO){

        Integer affectRow = commentService.commentDelete(commentDeleteBO);


        return Result.ok();
    }
}
